home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / prog / gnu-c / src / gcc-2.7.0-amiga / cpphash.h < prev    next >
C/C++ Source or Header  |  1995-01-07  |  1KB  |  41 lines

  1. enum node_type;
  2.  
  3. /* different kinds of things that can appear in the value field
  4.    of a hash node.  Actually, this may be useless now. */
  5. union hashval {
  6.   int ival;
  7.   char *cpval;
  8.   DEFINITION *defn;
  9. #if 0
  10.   KEYDEF *keydef;
  11. #endif
  12. };
  13.  
  14. struct hashnode {
  15.   struct hashnode *next;    /* double links for easy deletion */
  16.   struct hashnode *prev;
  17.   struct hashnode **bucket_hdr;    /* also, a back pointer to this node's hash
  18.                    chain is kept, in case the node is the head
  19.                    of the chain and gets deleted. */
  20.   enum node_type type;        /* type of special token */
  21.   int length;            /* length of token, for quick comparison */
  22.   U_CHAR *name;            /* the actual name */
  23.   union hashval value;        /* pointer to expansion, or whatever */
  24. };
  25.  
  26. typedef struct hashnode HASHNODE;
  27.  
  28. /* Some definitions for the hash table.  The hash function MUST be
  29.    computed as shown in hashf () below.  That is because the rescan
  30.    loop computes the hash value `on the fly' for most tokens,
  31.    in order to avoid the overhead of a lot of procedure calls to
  32.    the hashf () function.  Hashf () only exists for the sake of
  33.    politeness, for use when speed isn't so important. */
  34.  
  35. #define HASHSIZE 1403
  36. static HASHNODE *hashtab[HASHSIZE];
  37. #define HASHSTEP(old, c) ((old << 2) + c)
  38. #define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
  39.  
  40. extern HASHNODE* install PARAMS ((U_CHAR*,int,enum node_type, int,char*,int));
  41.